package com.nx.edu;

import lombok.AllArgsConstructor;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * jdk代理类
 *
 * @author Fxz
 * @version 1.0
 * @date 2021-08-12 9:02
 */
@AllArgsConstructor
public class NxMapperProxy implements InvocationHandler {
    private NxSqlSession nxSqlSession;

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        String statementId = method.getDeclaringClass().getName() + "." + method.getName();
        return nxSqlSession.selectOne(statementId,args[0]);
    }
}
